<template>
	<view class="TabBar">
		<view class="tab" v-for="(item, index) in TabBarList" :key="index" @tap="navigatorTo(item.url)">
			<image class="imgsize" :src="current == item.type ? item.selectIcon : item.icon" mode="widthFix"></image>
			<view :class="current == item.type ? 'right' : 'left'">{{ item.name }}</view>
		</view>
	</view>
</template>

<script>
export default {
	props: {
		current: {
			type: Number,
			default: 0 //默认第一个页面
		}
	},
	data() {
		return {
			TabBarList: [
				{
					type: 0,
					icon: '/static/images/tabbar/home.png',
					selectIcon: '/static/images/tabbar/home_selected.png',
					name: '首页',
					url: '/pages/Home/home'
				},
				{
					type: 1,
					icon: '/static/images/tabbar/index.png',
					selectIcon: '/static/images/tabbar/index_selected.png',
					name: '点单',
					url: '/pages/Order/order'
				},
				{
					type: 2,
					icon: '/static/images/tabbar/mart.png',
					selectIcon: '/static/images/tabbar/mart_selected.png',
					name: '百货',
					url: '/pages/Department/department'
				},
				
				{
					type: 3,
					icon: '/static/images/tabbar/order.png',
					selectIcon: '/static/images/tabbar/order_selected.png',
					name: '订单',
					url: '/pages/Book/book'
				},
				{
					type: 4,
					icon: '/static/images/tabbar/my.png',
					selectIcon: '/static/images/tabbar/my_selected.png',
					name: '我的',
					url: '/pages/Mine/mine'
				}
			]
		};
	},
	methods: {
		navigatorTo(e) {
			uni.navigateTo({
			    url: e,
			     animationType: 'none',
			    
			});
		}
	}
};
</script>

<style scoped>
.TabBar {
	position: fixed;
	bottom: 0;
	height: 98upx;
	background-color: #fff;
	width: 100%;
	display: flex;
	justify-content: space-around;
	align-items: center;
	background: rgba(255, 255, 255, 1);
	box-shadow: 0px 0px 8upx 1upx rgba(0, 0, 0, 0.11);
	padding-top: 10upx;
	z-index: 9;
}
.tab {
	display: flex;
	flex-direction: column;
	align-items: center;
}
.imgsize {
	width: 46upx;
	height: 46upx;
}
.addimgsize {
	width: 70upx;
	height: 70upx;
	margin-top: -30upx;
}
.left {
	font-size: 25upx;
	font-family: PingFang SC;
	font-weight: 400;
	color: #666666;
}
.right{
	font-size:25upx;
	font-family:PingFang SC;
	font-weight:400;
	color:rgba(45,47,86,1);
}
</style>